<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

require dirname(__FILE__).'/pc_controller.php';

class Hd_invitation_quanity_note extends PC_controller {

    public function __construct(){
        parent::__construct();
        $this->load->model('Hdinvitationreadingquanitymodel','m_reading_quanity');
    }

    public function index(){
        $data = parent::index();
        // $data['quanity_info'] = $this->m_reading_quanity->getReadingQuanityByUserId($this->m_app->getCurrentUserId());
        $this->load->view('admin/hd_invitation_quanity_note',$data);
    }

    public function noteQuanity() {
        $this->validate->setRule('image_path','file');
        $this->validate->setRule('quanity','integer');
        if(!$this->validate->run($this->input->post())){
            $this->response->setDetail($this->validate->getMessage());
            $this->response->responseExit();
        }
        $info = $this->validate->getResult();

        $info['image_path'] = $this->m_app->saveFile($info['image_path'],array(),UPLOAD_PATH_ORIGIN);
        $info['user_id'] = $this->m_app->getCurrentUserId();
        $info['reading_quanity_time_create'] = NOW;
        $this->m_reading_quanity->updateReadingQuanity($info);
        $this->m_reading_quanity->updateReadingQuanityRankList();

        $this->response->setSuccess();
        $this->response->responseExit();
    }

}
/* End of file aa_game_history.php */
/* Location: ./application/controllers/aa_game_history.php */
